package cn.hxy.bladeframework.controller;

import cn.hxy.bladeframework.model.UserModel;
import cn.hxy.bladeframework.service.UserService;
import com.blade.ioc.annotation.Inject;
import com.blade.mvc.annotation.GetRoute;
import com.blade.mvc.annotation.Param;
import com.blade.mvc.annotation.Path;
import com.blade.mvc.http.Response;

/**
 * @author eric
 * @description:
 * @date 1/4/20 5:00 PM
 */
@Path
public class UserController {
    @Inject
    private UserService userService;

    /**
     * 访问: http://127.0.0.1:9000/getuser?id=1
     * @param id
     * @param response
     */
    @GetRoute("/getuser")
    public void getUer(@Param int id, Response response) {
        UserModel user = userService.getUser(id);
        response.json(user);
    }
}
